﻿using System;
using System.ServiceModel;
using System.ServiceModel.Web;
using SimpleServiceBus.EndpointManagement.Wcf.Contracts.Operation;
using SimpleServiceBus.Utilities.ObjectBuilder;

namespace SimpleServiceBus.EndpointManagement.Server.Wcf
{
    public class EndpointManagementWebServiceHost : WebServiceHost
    {
        public EndpointManagementWebServiceHost(IObjectBuilder objectBuilder, Func<IDisposable> unitOfWorkProvider,params Uri[] addresses)
            : base(typeof(EndpointManagementWebService), addresses)
        {
            var behavior = new EndpointManagementServiceBehavior(objectBuilder, unitOfWorkProvider);
            Description.Behaviors.Add(behavior);
            var binding = new WebHttpBinding();
            AddServiceEndpoint(typeof(IEndpointManagementWebService), binding, "");
        }
    }
}
